/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wordcount;

import java.util.HashMap;
import java.util.Scanner;

/**
 *
 * @author theInterloper
 */
public class WordCount {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner input = new Scanner(System.in);
        System.out.println("Please enter a sentance");
        String wordIn = input.nextLine();
        String[] tokens = wordIn.split(" ");
        
        HashMap <String, Integer> myMap = new HashMap <String, Integer>();
        
        for (String token: tokens){
            if(myMap.containsKey(token)){
                int x = myMap.get(token);
                x++;
                myMap.put(token, x);
            }
            else{
                myMap.put(token,1);
            }
        }
        System.out.println(myMap);
    }
}
